package com.wq.babysecretary.presenter.impi;

import android.support.annotation.NonNull;

import com.wq.babysecretary.IView;
import com.wq.babysecretary.base.BasePresenterImpl;
import com.wq.babysecretary.model.impi.WebBookModelImpl;
import com.wq.babysecretary.presenter.IMainPresenter;
import com.wq.babysecretary.model.BaBayStoryModel;
import com.wq.babysecretary.view.IMainView;
import com.wq.babysecretary.weight.OnGetChapterListListener;
import com.wq.babysecretary.weight.SimpleObserver;

import java.util.List;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by admin on 2017/8/23.
 */

public class MainPresenterImpl extends BasePresenterImpl<IMainView> implements IMainPresenter {


    public void refreshBookShelf(String url) {

        WebBookModelImpl.getInstance().getStdroy(url)
                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new SimpleObserver<List<BaBayStoryModel>>() {
                    @Override
                    public void onNext(List<BaBayStoryModel> value) {
                                mView.getBookShelfAdapterDatas();

                    }

                    @Override
                    public void onError(Throwable e) {
                        e.printStackTrace();

                    }
                });


}

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////

    @Override
    public void attachView(@NonNull IView iView) {
        super.attachView(iView);
       // RxBus.get().register(this);
    }

    @Override
    public void detachView() {
       // RxBus.get().unregister(this);
    }


}
